package com.flyduck.system.vo.menu.trans;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.flyduck.common.vo.RouteVO;
import com.flyduck.system.entity.SysMenuEntity;
import com.google.common.base.Function;


/**
 * @program: flyduck-platform
 * @description:
 * @author: flyduck
 * @create: 2021-02-01 12:42
 **/
public class SysMenuEntityToRouteVO implements Function<SysMenuEntity, RouteVO> {

    @Override
    public RouteVO apply(SysMenuEntity sysMenuEntity) {
        RouteVO routeVO = new RouteVO();
        BeanUtil.copyProperties(sysMenuEntity, routeVO);
        routeVO.setId(sysMenuEntity.getId()+"");
        if(ObjectUtil.isNotNull(sysMenuEntity.getParentId())){
            routeVO.setParentId(sysMenuEntity.getParentId()+"");
        }
        routeVO.setSort(sysMenuEntity.getSort()+"");
        return routeVO;
    }
}
